/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Easy.table;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author DR.HUY
 */
@Entity
@Table(name = "Places", catalog = "EasyTicket", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Places.findAll", query = "SELECT p FROM Places p"),
    @NamedQuery(name = "Places.findByPlaceID", query = "SELECT p FROM Places p WHERE p.placeID = :placeID"),
    @NamedQuery(name = "Places.findByPlaceName", query = "SELECT p FROM Places p WHERE p.placeName = :placeName"),
    @NamedQuery(name = "Places.findByStatus", query = "SELECT p FROM Places p WHERE p.status = :status"),
    @NamedQuery(name = "Places.findByDecristion", query = "SELECT p FROM Places p WHERE p.decristion = :decristion")})
public class Places implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "PlaceID", nullable = false)
    private Integer placeID;
    @Basic(optional = false)
    @Column(name = "PlaceName", nullable = false, length = 50)
    private String placeName;
    @Column(name = "Status", length = 10)
    private String status;
    @Column(name = "Decristion", length = 100)
    private String decristion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "places")
    private Collection<Ticket> ticketCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "places")
    private Collection<Item> itemCollection;

    public Places() {
    }

    public Places(Integer placeID) {
        this.placeID = placeID;
    }

    public Places(Integer placeID, String placeName) {
        this.placeID = placeID;
        this.placeName = placeName;
    }

    public Integer getPlaceID() {
        return placeID;
    }

    public void setPlaceID(Integer placeID) {
        this.placeID = placeID;
    }

    public String getPlaceName() {
        return placeName;
    }

    public void setPlaceName(String placeName) {
        this.placeName = placeName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getDecristion() {
        return decristion;
    }

    public void setDecristion(String decristion) {
        this.decristion = decristion;
    }

    public Collection<Ticket> getTicketCollection() {
        return ticketCollection;
    }

    public void setTicketCollection(Collection<Ticket> ticketCollection) {
        this.ticketCollection = ticketCollection;
    }

    public Collection<Item> getItemCollection() {
        return itemCollection;
    }

    public void setItemCollection(Collection<Item> itemCollection) {
        this.itemCollection = itemCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (placeID != null ? placeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Places)) {
            return false;
        }
        Places other = (Places) object;
        if ((this.placeID == null && other.placeID != null) || (this.placeID != null && !this.placeID.equals(other.placeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Easy.table.Places[placeID=" + placeID + "]";
    }

}
